<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<ng-container *ngIf="!cookieService.isCloudBackup && !isHyperdetect; else elseBasicTemplate">
    <lv-group lvGutter='2px' class="aui-gutter-column-sm">
        <h2>{{'protection_backup_setting_label' | i18n}}</h2>
        <i lv-icon="aui-icon-help" [lv-tooltip]="backupTipTpl" ></i>
    </lv-group>
    <ng-template #backupTipTpl>
        <span innerHTML="{{'protection_backup_tip_label' | i18n}}"></span>
    </ng-template>
    <div class="tips" *ngIf="[appType.TiDB, appType.TDSQL].includes(applicationType)">
        <i style="display: inline-block; margin-right: 4px;" lv-icon="lv-icon-status-info" lvColorState='true'
            class="type-icon"></i>
        <span style="display: inline-block; width: 96%;">
            {{getSlaTips()}}
        </span>
    </div>
</ng-container>
<ng-template #elseBasicTemplate>
    <h2 class="aui-gutter-column-sm">{{'protection_basic_config_label' | i18n}}</h2>
</ng-template>
<p class="aui-gutter-column-sm" *ngIf="[appType.Oracle].includes(applicationType)">
    {{'protection_basic_config_desc_label' | i18n}}</p>
<lv-form [formGroup]="formGroup">
    <lv-tabs formArrayName="backupTeams" [lvType]="'underline'" [lvTabBarExtraContent]="isHyperdetect ? '' : extraTpl"
        [(lvActiveIndex)]="activeIndex" [lvClosable]="![].includes(applicationType) && !isHyperdetect"
        (lvTabRemove)="removeBackupTeam($event)">
        <lv-tab *ngFor="let item of formGroup.get('backupTeams')?.controls; let teamIndex = index"
            [formGroupName]="teamIndex" [lvTitle]="!isHyperdetect? title
				: i18n.get('common_production_snapshot_label')" [lvId]="item.get('name').value + teamIndex">
            <ng-template #title>
                <div lvOverflow>
                    {{ item.get('name').value + '(' + i18n.get(slaBackupName[item.get('action').value]) + ')' }}
                </div>
            </ng-template>
            <ng-container
                *ngIf="applicationType === appType.LocalFileSystem && cookieService.isCloudBackup && !isHyperdetect">
                <div class="aui-gutter-column-lg">
                    <lv-form-item>
                        <lv-form-label lvRequired>
                            {{'common_backup_storage_label' | i18n}}
                        </lv-form-label>
                        <lv-form-control [lvErrorTip]="baseUtilService.nameErrorTip">
                            <lv-group lvGutter="8px">
                                <lv-select [lvOptions]="storageNames" formControlName="storage_id"
                                    lvValueKey="repositoryId">
                                </lv-select>
                                <button lv-button (click)="addStorage()">
                                    {{'common_add_label'|i18n}}
                                </button>
                            </lv-group>
                        </lv-form-control>
                    </lv-form-item>
                </div>
            </ng-container>
            <div class="aui-gutter-column-md" *ngIf="!isHyperdetect">
                <ng-container>
                    <lv-form-item>
                        <lv-form-label lvRequired>{{ 'common_name_label' | i18n }}</lv-form-label>
                        <lv-form-control [lvErrorTip]="baseUtilService.nameErrorTip"> <input formControlName="name"
                                lv-input />
                        </lv-form-control>
                    </lv-form-item>
                </ng-container>
            </div>

            <div class="aui-gutter-column-md"
                *ngIf="[appType.Fileset, appType.NASShare, appType.ObjectStorage].includes(applicationType) && item.get('action').value === policyAction.INCREMENT">
                <lv-form-item>
                    <lv-form-label>{{ 'common_backup_label' | i18n }}</lv-form-label>
                    <lv-form-control>
                        <div style="position: relative; top:4px;">
                            <label lv-checkbox formControlName='permanentBackup'
                                [lvDisabled]="(!!isSpecialSense && action === protectResourceAction.Modify) || onlyIncrement">
                                {{'protection_file_permanent_backup_checkbox_label' | i18n }}
                            </label>
                        </div>
                    </lv-form-control>
                </lv-form-item>
            </div>

            <lv-alert lvType="info" lvClosable="false" *ngIf="isHyperdetect">
                {{'protection_hyperdect_sla_backup_tip_label' | i18n}}
            </lv-alert>
            <div class="aui-gutter-column-lg time-policy-container">
                <div class="aui-gutter-column-xs pdl-10 trigger-action-container">
                    <lv-radio-group formControlName="trigger_action" [lvGroupName]="'daysOfTypeGroup'">
                        <lv-group [lvGutter]="'24px'">
                            <ng-container *ngIf="item.get('action').value !== policyAction.LOG">
                                <lv-radio [lvValue]="daysOfType.DaysOfYear">
                                    {{'common_by_year_label' | i18n}}
                                </lv-radio>
                                <lv-radio [lvValue]="daysOfType.DaysOfMonth">
                                    {{'common_by_month_label' | i18n}}
                                </lv-radio>
                                <lv-radio [lvValue]="daysOfType.DaysOfWeek">
                                    {{'common_by_week_label' | i18n}}
                                </lv-radio>
                            </ng-container>
                            <lv-radio [lvValue]="daysOfType.DaysOfDay">
                                <ng-container *ngIf="i18n.isEn">
                                    {{'common_english_sla_by_day_label' | i18n}}
                                </ng-container>
                                <ng-container *ngIf="!i18n.isEn">
                                    {{'common_by_day_label' | i18n}}
                                </ng-container>
                            </lv-radio>
                            <lv-radio [lvValue]="daysOfType.DaysOfHour">
                                {{'common_by_hour_label' | i18n}}
                            </lv-radio>
                            <ng-container *ngIf="item.get('action').value !== policyAction.FULL">
                                <lv-radio [lvValue]="daysOfType.DaysOfMinute">
                                    {{'common_by_minute_label' | i18n}}
                                </lv-radio>
                            </ng-container>
                        </lv-group>
                    </lv-radio-group>
                </div>

                <!--天，小时，分钟-->
                <div *ngIf="_includes([daysOfType.DaysOfDay, daysOfType.DaysOfHour, daysOfType.DaysOfMinute], item.get('trigger_action').value)"
                    class="container" [ngClass]="{'container-en':i18n.isEn}">
                    <lv-group lvDirection='vertical' lvGutter="24px" [ngClass]="{'group-en':i18n.isEn}">
                        <lv-group lvGutter="3px">
                            <lv-group lvGutter="3px">
                                <ng-container *ngIf="i18n.isEn">
                                    <lv-form-label>{{'common_english_since_label' | i18n}}</lv-form-label>
                                </ng-container>
                                <ng-container *ngIf="!i18n.isEn">
                                    <lv-form-label>{{'common_from_label' | i18n}}</lv-form-label>
                                </ng-container>
                                <lv-form-control [lvErrorTip]="startTimeErrorTip">
                                    <lv-date-picker formControlName="start_time" class="start-time"
                                        [lvFormat]="item.get('action').value === policyAction.LOG ? 'yyyy-MM-dd HH:mm:ss':'yyyy-MM-dd'"
                                        lvShowNowButton="false"
                                        [lvShowTime]="item.get('action').value === policyAction.LOG">
                                    </lv-date-picker>
                                </lv-form-control>
                                <ng-container *ngIf="i18n.isEn">
                                    <lv-form-label>{{'common_comma_label' | i18n}}
                                    </lv-form-label>
                                </ng-container>
                                <ng-container *ngIf="!i18n.isEn">
                                    <lv-form-label>{{'common_start_label' | i18n}}{{'common_comma_label' | i18n}}
                                    </lv-form-label>
                                </ng-container>
                            </lv-group>
                            <lv-group lvGutter="3px">
                                <ng-container *ngIf="i18n.isEn">
                                    <lv-form-label>{{'common_english_executed_once_every_label' | i18n}}</lv-form-label>
                                </ng-container>
                                <ng-container *ngIf="!i18n.isEn">
                                    <lv-form-label>{{'common_every_label' | i18n}}</lv-form-label>
                                </ng-container>
                                <lv-form-control [lvErrorTip]="item.value.interval_error_tip" class="groupInControl">
                                    <lv-group lvGutter="8px" class="lv-group-flex-start">
                                        <lv-input-group [lvAddAfter]="afterTpl" class="interval-input-group">
                                            <input lv-input type="text" formControlName="interval"
                                                placeholder="{{item.get('trigger_action').value === daysOfType.DaysOfHour ? '1~23' : item.get('trigger_action').value === daysOfType.DaysOfDay ? '1~365' : item.get('action').value === policyAction.LOG ? '5~59' : '1~59'}}" />
                                        </lv-input-group>
                                        <ng-template #afterTpl>
                                            <span class="aui-text-desc">
                                                {{(item.get('trigger_action').value === daysOfType.DaysOfHour ?
                                                'common_hours_label' : item.get('trigger_action').value ===
                                                daysOfType.DaysOfDay ? 'common_days_label' : 'common_minutes_label') |
                                                i18n}}
                                            </span>
                                        </ng-template>
                                    </lv-group>
                                </lv-form-control>
                                <lv-form-label>
                                    <ng-container *ngIf="!i18n.isEn">
                                        {{'protection_execute_once_label' | i18n}}
                                    </ng-container>
                                    {{'common_comma_label' | i18n}}
                                </lv-form-label>
                            </lv-group>
                            <lv-group lvGutter="3px">
                                <ng-container>
                                    <ng-container *ngIf="i18n.isEn">
                                        <lv-form-label>
                                            {{'common_english_retained_label' | i18n}}
                                            <i *ngIf="item.get('action').value === policyAction.LOG"
                                                lv-icon="aui-icon-help"
                                                lv-tooltip="{{ 'protection_sla_log_retained_tip_label' | i18n }}"
                                                 lvTooltipPosition="top"
                                                class="configform-constraint" lvColorState="true"></i>
                                        </lv-form-label>
                                    </ng-container>
                                    <ng-container *ngIf="!i18n.isEn">
                                        <lv-form-label>
                                            {{'protection_copies_retention_label' | i18n}}
                                            <i *ngIf="item.get('action').value === policyAction.LOG"
                                                lv-icon="aui-icon-help"
                                                lv-tooltip="{{ 'protection_sla_log_retained_tip_label' | i18n }}"
                                                 lvTooltipPosition="top"
                                                class="configform-constraint" lvColorState="true"></i>
                                        </lv-form-label>
                                    </ng-container>
                                    <lv-form-control [lvErrorTip]="item.value.retention_duration_error_tip"
                                        class="groupInControl">
                                        <lv-input-group [lvAddAfter]="retainedUnitTpl" class="input-group-select-right">
                                            <input lv-input formControlName="retention_duration"
                                                placeholder="{{item.get('duration_unit').value=='d'?'1~365':item.get('duration_unit').value=='w'?'1~54':item.get('duration_unit').value=='MO'?'1~24':item.get('duration_unit').value=='p' ? '':'1~10'}}" />
                                        </lv-input-group>
                                        <ng-template #retainedUnitTpl>
                                            <lv-select [lvOptions]="durationUnitOptions" formControlName="duration_unit"
                                                class="unit-inner-select" lvValueKey="value"
                                                (ngModelChange)="changeUnit(item, item.get('duration_unit').value, 'retention_duration')"></lv-select>
                                        </ng-template>
                                    </lv-form-control>
                                </ng-container>
                            </lv-group>
                        </lv-group>
                        <lv-group lvGutter="3px" *ngIf="item.get('action').value !== policyAction.LOG">
                            <ng-container *ngIf="i18n.isEn">
                                <lv-form-label>{{'common_english_backup_allowed_from_label' | i18n}}</lv-form-label>
                            </ng-container>
                            <ng-container *ngIf="!i18n.isEn">
                                <lv-form-label>{{'common_from_label' | i18n}}</lv-form-label>
                            </ng-container> <lv-form-control [lvErrorTip]="windowStartTimeErrorTip">
                                <lv-time-picker formControlName="window_start" lvPlaceholder="HH:mm:ss"
                                    [lvFooter]="startTimePickerFooterTpl" class="start-time">
                                </lv-time-picker>
                            </lv-form-control>
                            <ng-container *ngIf="i18n.isEn">
                                <lv-form-label>{{'common_english_to_low_case_label' | i18n}}</lv-form-label>
                            </ng-container>
                            <ng-container *ngIf="!i18n.isEn">
                                <lv-form-label>{{'common_to_label' | i18n}}</lv-form-label>
                            </ng-container>
                            <lv-form-control [lvErrorTip]="windowEndTimeErrorTip">
                                <lv-time-picker formControlName="window_end" lvPlaceholder="HH:mm:ss"
                                    [lvFooter]="endTimePickerFooterTpl" class="end-time">
                                </lv-time-picker>
                            </lv-form-control>
                            <ng-container *ngIf="!i18n.isEn">
                                <lv-form-label>{{'protection_allow_backup_label' | i18n}}</lv-form-label>
                            </ng-container>
                        </lv-group>
                        <ng-template #startTimePickerFooterTpl>
                            <button lv-button lvType="link" class="time-picker-current"
                                (click)="setSysTime(item.get('window_start'))">
                                {{'common_current_time_label' | i18n}}
                            </button>
                        </ng-template>
                        <ng-template #endTimePickerFooterTpl>
                            <button lv-button lvType="link" class="time-picker-current"
                                (click)="setSysTime(item.get('window_end'))">
                                {{'common_current_time_label' | i18n}}
                            </button>
                        </ng-template>
                    </lv-group>
                </div>

                <div *ngIf="_includes([daysOfType.DaysOfYear, daysOfType.DaysOfMonth, daysOfType.DaysOfWeek], item.get('trigger_action').value)"
                    class="container" [ngClass]="{'container-en':i18n.isEn}">
                    <lv-group lvDirection='vertical' lvGutter="24px">
                        <lv-group lvGutter="3px">
                            <lv-group lvGutter="3px">

                                <!--每年-->
                                <ng-container *ngIf="item.get('trigger_action').value === daysOfType.DaysOfYear">
                                    <ng-container *ngIf="i18n.isEn">
                                        <lv-form-label>{{'common_english_executed_once_on_label' |
                                            i18n}}</lv-form-label>
                                    </ng-container>
                                    <ng-container *ngIf="!i18n.isEn">
                                        <lv-form-label>{{'common_every_year_label' | i18n}}</lv-form-label>
                                    </ng-container>
                                    <lv-form-control [lvErrorTip]="daysOfYearErrorTip" class="groupInControl">
                                        <lv-date-picker formControlName="days_of_year" class="start-time"
                                            lvFormat="MM-dd" [lvCalendarYearOperate]="{ show: false }"
                                            lvShowNowButton="false">
                                        </lv-date-picker>
                                    </lv-form-control>
                                    <ng-container *ngIf="i18n.isEn">
                                        <lv-form-label>{{'common_english_of_every_year_label' |
                                            i18n}}{{'common_comma_label' |
                                            i18n}}
                                        </lv-form-label> </ng-container>
                                    <ng-container *ngIf="!i18n.isEn">
                                        <lv-form-label>{{'protection_execute_once_label' | i18n}}{{'common_comma_label'
                                            |
                                            i18n}}
                                        </lv-form-label>
                                    </ng-container>

                                </ng-container>

                                <!--每月-->
                                <ng-container *ngIf="item.get('trigger_action').value === daysOfType.DaysOfMonth">
                                    <ng-container *ngIf="i18n.isEn">
                                        <lv-form-label>{{'common_english_executed_once_on_label' |
                                            i18n}}</lv-form-label>
                                    </ng-container>
                                    <ng-container *ngIf="!i18n.isEn">
                                        <lv-form-label>{{'common_every_month_label' | i18n}}</lv-form-label>
                                    </ng-container>
                                    <lv-group lvGutter="8px" class="lv-group-flex-start">
                                        <lv-select [lvOptions]="daysOfMonthOptions" formControlName="days_of_month_type"
                                            lvValueKey="value" class="day-of-month-type"></lv-select>
                                        <ng-container
                                            *ngIf="item.get('days_of_month_type').value === daysOfMonthType.specifiedDate.value">
                                            <lv-form-control [lvErrorTip]="daysOfMonthErrorTip"
                                                class="groupInControl daysOfMonthGroup">
                                                <lv-input-group [lvSuffix]="suffixTpl" #popover="lvPopover" lv-popover
                                                    [lvPopoverContent]="daysOfMonthTpl"
                                                    lvPopoverPosition="bottom" lvPopoverTrigger="click"
                                                    lvPopoverShowArrow="false" lvPopoverBackdrop="true"
                                                    lvPopoverMaskTransparent="true"
                                                    lvPopoverClassName="customer-popover">
                                                    <input lv-input formControlName="days_of_month" readonly="readonly"
                                                        placeholder="{{'protection_select_date_label'|i18n}}" />
                                                </lv-input-group>
                                            </lv-form-control>
                                            <ng-template #suffixTpl>
                                                <i lv-icon="lv-icon-triangle-down"></i>
                                            </ng-template>
                                            <ng-template #daysOfMonthTpl>
                                                <lv-group lvDirection='vertical'>
                                                    <lv-checkbox-group #daysOfMonthGroup
                                                        formControlName="days_of_months">
                                                        <ng-container *ngFor="let data of monthDaysItems">
                                                            <lv-group [lvGutter]="'16px'" class="month-day">
                                                                <ng-container *ngFor="let d of data.key">
                                                                    <lv-checkbox [lvViewType]="'custom'" [lvValue]="d">
                                                                        <div class="month-card"
                                                                            [ngClass]="{'select': daysOfMonthGroup.isChecked(d)}">
                                                                            {{d}}
                                                                        </div>
                                                                    </lv-checkbox>
                                                                </ng-container>
                                                            </lv-group>
                                                        </ng-container>
                                                    </lv-checkbox-group>
                                                    <div class="aui-text-help solid-line">
                                                        {{'protection_days_of_month_desc_label'|i18n}}
                                                    </div>
                                                </lv-group>
                                            </ng-template>
                                        </ng-container>
                                    </lv-group>
                                    <ng-container *ngIf="i18n.isEn">
                                        <lv-form-label>{{'common_english_of_every_month_label' |
                                            i18n}}{{'common_comma_label' |
                                            i18n}}
                                        </lv-form-label>
                                    </ng-container>
                                    <ng-container *ngIf="!i18n.isEn">
                                        <lv-form-label>{{'protection_execute_once_label' | i18n}}{{'common_comma_label'
                                            |
                                            i18n}}
                                        </lv-form-label>
                                    </ng-container>
                                </ng-container>

                                <!--每周-->
                                <ng-container *ngIf="item.get('trigger_action').value === daysOfType.DaysOfWeek">
                                    <ng-container *ngIf="i18n.isEn">
                                        <lv-form-label>{{'common_english_executed_once_on_label' |
                                            i18n}}</lv-form-label>
                                    </ng-container>
                                    <ng-container *ngIf="!i18n.isEn">
                                        <lv-form-label>{{'common_every_week_label' | i18n}}</lv-form-label>
                                    </ng-container>
                                    <div class="day-of-week-container">
                                        <lv-form-control [lvErrorTip]="daysOfWeekErrorTip" class="groupInControl">
                                            <lv-select [lvOptions]="daysOfWeekOptions" formControlName="days_of_week"
                                                lvValueKey="value" class="day-of-week" lvMode='multiple' lvShowFilter
                                                lvShowCheckAll lvFilterKey="label" lvFilterMode='contains'></lv-select>
                                        </lv-form-control>
                                    </div>
                                    <ng-container *ngIf="i18n.isEn">
                                        <lv-form-label>{{'common_english_of_every_week_label' |
                                            i18n}}{{'common_comma_label' |
                                            i18n}}
                                        </lv-form-label>
                                    </ng-container>
                                    <ng-container *ngIf="!i18n.isEn">
                                        <lv-form-label>{{'protection_execute_once_label' | i18n}}{{'common_comma_label'
                                            |
                                            i18n}}
                                        </lv-form-label>
                                    </ng-container>
                                </ng-container>
                            </lv-group>
                            <lv-group lvGutter="3px">
                                <ng-container *ngIf="i18n.isEn">
                                    <lv-form-label>{{'common_english_retained_label' | i18n}}</lv-form-label>
                                </ng-container>
                                <ng-container *ngIf="!i18n.isEn">
                                    <lv-form-label>{{'protection_copies_retention_label' | i18n}}</lv-form-label>
                                </ng-container>
                                <lv-form-control [lvErrorTip]="item.value.special_retention_duration_error_tip"
                                    class="groupInControl">
                                    <lv-input-group [lvAddAfter]="unitTpl" class="input-group-select-right">
                                        <input lv-input formControlName="specified_retention_duration"
                                            placeholder="{{item.get('specified_duration_unit').value=='d'?'1~365':item.get('specified_duration_unit').value=='w'?'1~54':item.get('specified_duration_unit').value=='MO'?'1~24':item.get('specified_duration_unit').value=='p' ? '':'1~10'}}" />
                                    </lv-input-group>
                                    <ng-template #unitTpl>
                                        <lv-select [lvOptions]="durationUnitOptions"
                                            formControlName="specified_duration_unit" class="unit-inner-select"
                                            lvValueKey="value"
                                            (ngModelChange)="changeUnit(item, item.get('specified_duration_unit').value, 'specified_retention_duration')"></lv-select>
                                    </ng-template>
                                </lv-form-control>
                            </lv-group>
                        </lv-group>
                        <lv-group lvGutter="3px">
                            <ng-container *ngIf="i18n.isEn">
                                <lv-form-label>{{'common_english_backup_allowed_from_label' | i18n}}</lv-form-label>
                            </ng-container>
                            <ng-container *ngIf="!i18n.isEn">
                                <lv-form-label>{{'common_from_label' | i18n}}</lv-form-label>
                            </ng-container>
                            <lv-form-control [lvErrorTip]="windowStartTimeErrorTip">
                                <lv-time-picker formControlName="specified_window_start" lvPlaceholder="HH:mm:ss"
                                    [lvFooter]="specifiedStartTimePickerFooterTpl" class="start-time">
                                </lv-time-picker>
                            </lv-form-control>
                            <ng-container *ngIf="i18n.isEn">
                                <lv-form-label>{{'common_english_to_low_case_label' | i18n}}</lv-form-label>
                            </ng-container>
                            <ng-container *ngIf="!i18n.isEn">
                                <lv-form-label>{{'common_to_label' | i18n}}</lv-form-label>
                            </ng-container>
                            <lv-form-control [lvErrorTip]="windowEndTimeErrorTip">
                                <lv-time-picker formControlName="specified_window_end" lvPlaceholder="HH:mm:ss"
                                    [lvFooter]="specifiedEndTimePickerFooterTpl" class="end-time">
                                </lv-time-picker>
                            </lv-form-control>
                            <ng-container *ngIf="!i18n.isEn">
                                <lv-form-label>{{'protection_allow_backup_label' | i18n}}</lv-form-label>
                            </ng-container>
                        </lv-group>
                        <ng-template #specifiedStartTimePickerFooterTpl>
                            <button lv-button lvType="link" class="time-picker-current"
                                (click)="setSysTime(item.get('specified_window_start'))">
                                {{'common_current_time_label' | i18n}}
                            </button>
                        </ng-template>
                        <ng-template #specifiedEndTimePickerFooterTpl>
                            <button lv-button lvType="link" class="time-picker-current"
                                (click)="setSysTime(item.get('specified_window_end'))">
                                {{'common_current_time_label' | i18n}}
                            </button>
                        </ng-template>
                    </lv-group>
                </div>
            </div>

            <ng-container
                *ngIf="applicationType === appType.HBase && [policyAction.FULL, policyAction.INCREMENT].includes(item.get('action').value)">
                <div class="aui-gutter-column-md">
                    <lv-form-item>
                        <lv-form-label>
                            <h2>{{'protection_keep_snapshot_label' | i18n}}</h2>
                        </lv-form-label>
                        <lv-form-control>
                            <lv-group lvGutter="8px">
                                <lv-switch formControlName="is_reserved_latest_snapshot"></lv-switch>
                                <span>{{'protection_keep_snapshot_desc_label' | i18n}}</span>
                            </lv-group>
                        </lv-form-control>
                    </lv-form-item>
                </div>
            </ng-container>
            <ng-container *ngIf="!isCyber&&!isDistributed&&applicationType!==appType.CommonShare">
                <lv-form-item>
                    <lv-form-label style="font-size: 14px;font-weight: 700;">{{'WORM' | i18n}} <i
                            lv-icon="aui-icon-help" [lv-tooltip]="wormTipTpl"
                            style="margin-left:4px"></i>
                    </lv-form-label>
                    <lv-form-control>
                        <lv-switch formControlName="worm_switch" [lvDisabled]="isWormData||isBasicDisk"></lv-switch>
                        <lv-alert lvType="info" *ngIf="isWormData" class="worm-alert-mgt">
                            <h2 class="lv-alert-title">{{'common_security_worm_alarm_label'|i18n}}</h2>
                        </lv-alert>
                        <ng-container *ngIf="item.get('worm_switch').value">
                            <lv-form-label>{{'common_worm_validity_label' | i18n}}</lv-form-label>
                            <lv-form-control class="groupInControl">
                                <lv-group lvGutter='8px' class="lv-group-flex-start">
                                    <div>
                                        <lv-radio-group [lvGroupName]="'wormTypeGroup'"
                                            formControlName="worm_validity_type">
                                            <lv-group [lvGutter]="'24px'">
                                                <lv-radio [lvValue]="1">
                                                    {{'common_worm_same_validity_label' | i18n}}
                                                    <i lv-icon="aui-icon-help"
                                                        lv-tooltip="{{ 'common_worm_same_validity_tip_label' | i18n }}"
                                                         lvTooltipPosition="top"
                                                        class="configform-constraint" lvColorState="true"
                                                        style="margin-bottom:3px"></i>
                                                </lv-radio>
                                                <lv-radio [lvValue]="2">
                                                    {{'common_worm_custom_validity_label' | i18n}}
                                                </lv-radio>
                                            </lv-group>
                                        </lv-radio-group>
                                        <ng-container *ngIf="item.get('worm_validity_type').value===2">
                                            <lv-form-control
                                                [lvErrorTip]="item.value.special_retention_duration_error_tip"
                                                class="groupInControl">
                                                <ng-container>{{'common_valid_worm_label' | i18n}}</ng-container>
                                                <lv-input-group [lvAddAfter]="unitTpl" class="input-group-select-right">
                                                    <input lv-input formControlName="worm_specified_retention_duration"
                                                        placeholder="{{dataMap.unitPlaceHolderMap[item.get('worm_specified_duration_unit').value]}}" />
                                                </lv-input-group>
                                                <ng-template #unitTpl>
                                                    <lv-select [lvOptions]="wormDurationUnitOptions"
                                                        formControlName="worm_specified_duration_unit"
                                                        class="unit-inner-select" lvValueKey="value"
                                                        (ngModelChange)="changeUnit(item, item.get('worm_specified_duration_unit').value, 'worm_specified_retention_duration')"></lv-select>
                                                </ng-template>
                                            </lv-form-control>
                                        </ng-container>
                                    </div>

                                </lv-group>
                            </lv-form-control>
                        </ng-container>
                    </lv-form-control>
                </lv-form-item>
            </ng-container>
        </lv-tab>
    </lv-tabs>
</lv-form>

<ng-template #wormTipTpl>
    <span innerHTML="{{'common_open_worm_tips_label' | i18n}}"></span>
</ng-template>

<ng-template #extraTpl>
    <ng-container
        *ngIf="!isSpecialSense || ![appType.Fileset, appType.NASShare, appType.Volume, appType.ObjectStorage].includes(applicationType) || action !== protectResourceAction.Modify ">
        <a lv-dropdown [lvDropdownMenus]="optsItems" [lvDropdownTrigger]="'click'">
            <i lv-icon="lv-icon-create" class="create-icon-pos-polyfill aui-link"></i>
            {{'common_add_policy_label' | i18n}}
            <i #lvDropdownTrigger lv-icon="lv-icon-triangle-down"></i>
        </a>
    </ng-container>
</ng-template>
